# --------------------------------------------------------------------------------------------------------------------
# Project:             Digital Payment System (DPS)
# Website:             http://code.google.com/p/dps-x509/
# Purpose of document: Database entry for certificate
# --------------------------------------------------------------------------------------------------------------------
from google.appengine.ext import db

# --------------------------------------------------------------------------------------------------------------------
class Certificate(db.Model):
  """ Database entry for x509 certificate """
  issuerCertificate_    = db.SelfReferenceProperty() # id of base certificate
  base64RawCertificate_ = db.TextProperty()
  issuer_               = db.TextProperty()
  isTokenCertificate_   = db.BooleanProperty() # if this cert contains token data (ie. token type, value) this is true. true also if it is a desendent of a token certificate 
  isValid_              = db.BooleanProperty() # has it been revoked or otherwise cancelled?
  subject_              = db.TextProperty() # this is just the display data
  subjectBase64_        = db.TextProperty() # this is the entire base64 encoded subject block
  redeemer_             = db.StringProperty()
  exchanger_            = db.StringProperty()
  registrar_            = db.StringProperty()
  tokenType_            = db.StringProperty()
  tokenQuantity_        = db.IntegerProperty() #Float prop not supported in my version on python 2.5
  positionInChain_      = db.IntegerProperty() # self certified = 0
  registrationDate_     = db.DateTimeProperty(auto_now_add=True)
  isActive_             = db.BooleanProperty() # when a certificate is registered is is active. 
                                               # when it is reissued it becomes inactive
  
  
